<template>
<div>
	<h3 class="base-title">基础用法</h3>
	<p class="base-content">适用性广泛的通知栏</p>

	<div class="demo-block" :class="{'show-case-core':caseObj1.showCoreFlag}">
		<div class="demo-block-source">
			<bh-button type='primary' @click='open1()'>主要按钮</bh-button>
			<bh-button type='success' @click='open2()'>成功按钮</bh-button>
		</div>
		<div class="demo-block-core">
			<textarea class="demo-core-box" readonly="readonly" v-model="caseSourceVal" style='height: 370px;'></textarea>
		</div>
		<div class="demo-block-footer">
			<div class="demo-ms-arr" @click='toggleDemoCore(caseObj1)'>
				<span class="demo-ms-s">显示代码</span>
				<span class="demo-ms-h">隐藏代码</span>
			</div>
			<a :href="caseObj1.coreUrl" target="_blank" class="demo-online" title="前往 codepen.io 运行此示例">在线运行</a>
		</div>
	</div>
</div>
</template>

<script>
const caseSourceVal = `
<template>
<bh-button type='primary' @click='open1()'>主要按钮</bh-button>
<bh-button type='success' @click='open2()'>成功按钮</bh-button>
</template>
export default {
	methods: {
		open1() {
			this.$notify({
				title: '提示',
				message: '这是一条会自动关闭的消息',
				duration: 2000
			});
		},
		open2() {
			this.$notify({
				title: '提示',
				message: '这是一条不会自动关闭的消息',
				duration: 0
			});
		},
	},
}
`;
export default {
	data () {
		return {
			caseObj1: {
				showCoreFlag: false,
				coreUrl: 'https://codepen.io/xiebaolin/pen/VwzLbjy',
			},
			caseSourceVal: caseSourceVal,
		};
	},
	methods: {
		// 切换代码显隐
		toggleDemoCore (item) {
			item.showCoreFlag = !item.showCoreFlag;
		},

		open1() {
			this.$notify({
				title: '提示',
				message: '这是一条会自动关闭的消息',
				duration: 2000
			});
		},
		open2() {
			this.$notify({
				title: '提示',
				message: '这是一条不会自动关闭的消息',
				duration: 0
			});
		},
	},
}
</script>

<style scoped>
</style>
